﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using NetDon.OA.Data.HelperClasses;


namespace NetDon.OA.Interface
{
    public interface IIssuingOrderService
    {

        DataTable GetMachineAccountOrders(IssuingOrderSearchCriteria criteria, string sortExpression,
                                          SortDirection sortDirection, int pageSize, int pageIndex);

        int GetOrderCount(IssuingOrderSearchCriteria criteria);
        int GetGetMachineAccountOrdersCount(IssuingOrderSearchCriteria criteria);

        
         DataTable  SearchOrdersByCondition(IssuingOrderSearchCriteria criteria,
            string sortExpression, SortDirection sortDirection, int pageSize, int pageIndex);

         bool AddOrder(IssuingOrderData entity);
         bool ModifyOrder(IssuingOrderData entity);
         bool ModifyOrderStatus(Guid issuingOrderId, OrderStatus orderStatus);
         bool AutoConfirmOrderClosure();
        bool ConfirmOrderClosure(Guid issuingOrderId);
         bool RemoveOrder(Guid orderId);
        
        IssuingOrderData GetIssuingOrder(Guid issuingOrderId);
        IssuingOrderData GetIssuingOrderByOrderCode(string orderCode);
        string[] GetIssuingOrderByOrderCode(string orderCode, int count);

        IssuingOrderData GetIssuingOrderByTransportationPlanCode(string transportationPlanCode);

        IssuingOrderData GetSimpleIssuingOrder(Guid issuingOrderId);
        bool RemoveIssuingOrderDelivery(Guid issuingOrderDeliveryId);
        IssuingOrderDeliveryData GetIssuingOrderDelivery(Guid issuingOrderDeliveryId);
        IEnumerable<IssuingOrderDeliveryData> GetIssuingOrderDeliveryByOrderId(Guid issuingOrderId);
        IEnumerable<IssuingOrderVehicleData> GetIssuingOrderVehicleInfo(Guid issuingOrderId);
        string[] GetIssuingOrderAddress(string prefix, int count);

        bool UpdateShuntingCost(Dictionary<Guid, decimal?> shuntingCosts);

        bool UpdateGoodsUnloadingCost(Transaction trans, Guid issuingOrderId, decimal goodsUnloadingCost);

        bool CheckIsPaymentExist(Guid issuingOrderId);

        decimal? GetUnitCost(Guid companyId, string deliveryCity, Guid? routeTypeId);
        decimal? GetRevenueUnitCost(Guid companyId, string deliveryCity, Guid? routeTypeId);

        bool ModifyIssuingOrderDeliveies(Guid routeTypeId, string delvieryProvince,
                                         IEnumerable<IssuingOrderDeliveryData> issuingOrderDeliveryDataList);

        bool ExistsIssuingOrderByTransportationPlanCode(Guid id , string transportationPlanCode);
    }
}

